package com.ld.security.common.core.exception;

import lombok.Data;

/**
 * 业务异常基本类
 */
@Data
public class ApiException extends SuperException {

	private int code;


	public ApiException(String arg0, Throwable arg1, int code) {
		super(arg0, arg1);
		this.code = code;
	}

	public ApiException(int code, String msg) {
		super(msg);
		this.code = code;
	}
	public static void throw400(String msg,Throwable arg1){
		throw new ApiException(msg,arg1,400);
	}

	public static void throw400(boolean b,String msg){
		if(b){
			throw new ApiException(400,msg);
		}

	}

	public static void throw400(String msg){
		throw new ApiException(400,msg);
	}


	public static void throw401(String msg){
		throw new ApiException(401,msg);
	}

	public static void throw404(String msg){
		throw new ApiException(404,msg);
	}
	public static void throw500(String msg){
		throw new ApiException(500,msg);
	}

}
